﻿#ifndef DC_DRAW_SETTING_DIALOG_H
#define DC_DRAW_SETTING_DIALOG_H

#include <QDialog>
#include <QMap>
#include <QDebug>

#include <QWidget>
#include <QLabel>
#include <QPushButton>
#include <QScrollBar>
#include <QColorDialog>

#include "plot_global.h"

class PlotColorSettingItem : public QWidget
{
	Q_OBJECT
public:
	PlotColorSettingItem(QWidget* parent = 0);
	PlotColorSettingItem(const QString& text, const QString& color = "ffffffff", QWidget* parent = 0);

	void SetItemLabel(const QString& text);
	QString GetItemLabel();
	void SetItemColor(const QString& color);
	QString GetItemColor();

private:
	void SettingColor();

private:
	QLabel* label;
	QPushButton* select_btn;
	QString color_;
};


namespace Ui {
	class DrawSettingDialog;
}

class DrawSettingDialog : public QDialog
{
	Q_OBJECT

public:
	explicit DrawSettingDialog(QWidget* parent = 0);
	~DrawSettingDialog();

	void InitSettingConfig(const PlotSettingConfig& setting);

private:
	void AddNewColorItem();
	void DeleteColorItem();
	//其他绘图颜色设置
	void SettingOtherColor();
	//获取颜色曲线配置
	void GetPlotsColor();
	//获取绘图其他颜色配置
	void GetOtherDrawColor();
	//获取其他属性配置
	void GetPlotAttr();
	//按钮填充颜色
	void OtherDrawColor(QPushButton*, QString);
	//ok
	void OK();
	//取消
	void Cancel();
	//应用
	void Apply();


signals:
	void OkSignal(const PlotSettingConfig&);
	void ApplySignal(const PlotSettingConfig&);

private:
	Ui::DrawSettingDialog* ui;
	PlotSettingConfig plot_config_;
	QMap<QPushButton*, QString> btn_color_map_;
};




#endif // DC_DRAW_SETTING_DIALOG_H
